<!DOCTYPE html>
<html>
    <body>
        <p id="demo">你好</p>
        <button onclick="fun()">点我</button>
        <script>
            function fun(){
                var name = "ning";
                document.getElementById("demo").innerHTML = name;
            }
        </script>
    </body>
</html>